from_lavc_vid_conv: guard NULL conversion in get_av_to_uv_conversion - #504
Merged
Merged
Conversation
get_av_to_uv_conversion_int() can return a valid struct with conversion == NULL (direct pixfmt map, decoder, or CUDA early-return paths), but since ecd4c53 the VERBOSE message unconditionally dereferences ret->conversion->uv_codec, SEGV when -t file: decodes to a directly-mapped format. Regression introduced in ecd4c53.
Collaborator
|
I was able to reproduce this with The fix looks good to me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When running encoder viability tests with file input to gauge codec suitability, I ran into an UltraGrid SEGV situation.
Root cause:
get_av_to_uv_conversion_int() can return a valid struct with conversion == NULL (the direct pixfmt-map, decoder, or CUDA early-return paths).
Since ecd4c53, the VERBOSE message in get_av_to_uv_conversion() unconditionally dereferences ret->conversion->uv_codec, crashing whenever a decoder emits a directly-mapped format (e.g. HEVC VAAPI -> NV12)
"-t file:$arg" was my vector for discovering it.
Fix:
guard the dereference. When conversion is NULL, fall through to the plain "converting A to B" message (which is accurate for those paths). Doing the same short-circuit elsewhere is unnecessary — the consumer in do_av_to_uv_conversion() already guards conversion != NULL.
I performed a local build with the patched file, ran through a couple of tests and it seemed OK.
It seems to have been introduced in ecd4c53.